// custom-tab-bar/index.js
import {storeBindingsBehavior} from 'mobx-miniprogram-bindings'
import {store} from '../store/index'
Component({    
    options: {
        styleIsolation: 'shared'
    },
    behaviors: [storeBindingsBehavior],
    storeBindings: {
        store,
        fields: {
            active: 'activetabbar'
        },
        actions: {
            updateActiveTabbar: 'updateActiveTabbar'
        }
    },
    /**
     * 组件的属性列表
     */
    properties: {

    },

    /**
     * 组件的初始数据
     */
    data: {
        tabbarList: [{
                message: '首页',
                icon: 'home-o',
                name: 'home'
            },
            {
                message: '其它',
                icon: 'chat-o',
                name: 'message',
            }
        ],

        mapTabbar: {
            home: "/pages/index/index",
            message: "/pages/logs/logs",
        }
    },

    /**
     * 组件的方法列表
     */
    methods: {
        changeTab(event) {
            const url = this.data.mapTabbar[event.detail]
            wx.switchTab({
                url,
            })
            this.updateActiveTabbar(event.detail)
        }
    },

    
})